﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using StateGrid;
using StateGrid.User;
using StateGrid.OperationLog;

public partial class Pages_DailyRecord_Detail : System.Web.UI.Page
{
    /// <summary>
    /// 日志操作对象
    /// </summary>
    private OperationLog_DAO logDAO = new OperationLog_DAO();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!UserManageDAO.IsLogin((User)Session["login"]))
        {
            GlobalMethod.RedirectLogin(Response);
            return;
        }
        if (!this.IsPostBack)
        {
            this.BindData();
        }
    }

    /// <summary>
    /// 绑定数据
    /// </summary>
    private void BindData()
    {
        int id=0;
        try
        {
            id = Int32.Parse(Request["id"]);
        }
        catch (Exception)
        {
            Response.Redirect(StateGrid.GlobalVariables.GlobalResource.ERROR_PAGE + "?message=错误：参数错误");
            return;
        }

        OperationLogItem log = this.logDAO.SelectLogByID(id);
        if (null == log)
        {
            Response.Redirect(StateGrid.GlobalVariables.GlobalResource.ERROR_PAGE + "?message=错误：没有找到您要查询的日志信息");
            return;
        }
        //操作类型
        this.typeLabel.Text = log.opType;
        //数据库表
        this.databaseLabel.Text = log.opTable;
        //文库
        this.wkLabel.Text = log.opBookIn;
        //页数
        this.ysLabel.Text = log.opPageCount.ToString();
        //操作内容
        this.contentTextBox.Text = log.opContent;
        //操作模式
        this.modeLabel.Text = log.opMode;
        //操作时间
        this.opDateLabel.Text = log.opDate.ToString();
        //操作人
        this.opPersonLabel.Text = log.opPerson;

    }
    protected void closeButton_Click(object sender, EventArgs e)
    {
         //关闭页面--要弹出提示（IE6及以下不弹出提示）
        ClientScript.RegisterStartupScript(Page.GetType(), "", "<script language=javascript>window.opener=null;window.close();</script>");

        //不弹出提示直接关闭页面
        //ClientScript.RegisterStartupScript(Page.GetType(), "", "<script language=javascript>window.opener=null;window.open('','_self');window.close();</script>");
    }
}